import datetime
import json
from typing import Any, List, Dict

from pydantic import BaseModel
from fastapi import FastAPI, Depends

app = FastAPI()


class HuaWei(BaseModel):
    """
        {
      "ban_category": "rwy_forbid",
      "date_bjt": "2023-09-23",
      "callsign": "TTTT",
      "arr_ap": "ZZZZ",
      "eobt": "2023-10-08 05:00:00",
      "sobt": "2023-10-08 05:00:00",
      "airline": "H15",
      "cnms_item_e": "11 下列航路( 线 ) 段高度在 8,100M （含）以下禁航:\n1.J157 航线 ( 格尔木VOR'GRM' - DUMIN ）段, \n2.X111 航线 ( 格尔木VOR'GRM' - 花土沟VOR'HTG' ）段,\n3.X139 航线 ( 茶卡VOR'CKA' - 格尔木VOR'GRM' ）段,\n4.H15  航线 ( 德令哈VOR'DLH' - 格尔木VOR'GRM' - TEMOL ）段. \n",
      "cnms_item_b_date_bjt": "2023-10-08 05:00:00",
      "cnms_item_c_date_bjt": "2023-10-08 05:00:00",
      "cnms_item_d": "02:20-06:00 ON MON TUE WED FRI SAT",
      "notam_num": "C 3577/23"
    }
    """

    ban_category: str = "rwy_forbid"
    date_bjt: str = "2023-09-23"
    callsign: str = "TTTT"
    arr_ap: str = "ZZZZ"
    eobt: str = "2023-10-08 05:00:00"
    sobt: str = "2023-10-08 05:00:00"
    airline: str = "H15"
    cnms_item_e: str = "11 下列航路( 线 ) 段高度在 8,100M （含）以下禁航:\n1.J157 航线 ( 格尔木VOR'GRM' - DUMIN ）段, \n2.X111 航线 ( 格尔木VOR'GRM' - 花土沟VOR'HTG' ）段,\n3.X139 航线 ( 茶卡VOR'CKA' - 格尔木VOR'GRM' ）段,\n4.H15  航线 ( 德令哈VOR'DLH' - 格尔木VOR'GRM' - TEMOL ）段. \n"
    cnms_item_b_date_bjt: str = "2023-10-08 05:00:00"
    cnms_item_c_date_bjt: str = "2023-10-08 05:00:00"
    cnms_item_d: str = "02:20-06:00 ON MON TUE WED FRI SAT"
    notam_num: str = "C 3577/23"


@app.get("/v1.0/api_intelligent_tower_get_roma_notam", response_model=List[HuaWei])
async def api_intelligent_tower_get_roma_notam() -> Any:
    # result = {}
    with open("demo.json", "r", encoding="UTF-8") as __file:
        data = json.loads(__file.read())
    # print(datetime.UTC)

    result: List[HuaWei] = [data for i in range(10)]
    # data = result[0]
    return result


if __name__ == "__main__":
    import uvicorn

    uvicorn.run("ARO数据接入:app", port=8081, reload=True, host="0.0.0.0")
